package com.tang.controller;


import com.tang.pojo.TProduct;
import com.tang.service.TProductService;
import com.tang.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author tang
 * @since 2025-03-27
 */
@CrossOrigin //开放前端的跨域访问
@Api(tags = "商品管理")
@RestController
@RequestMapping("/api/product")
@Slf4j
public class TProductController {
    @Autowired
    private TProductService productService;


    @ApiOperation("商品列表")
    @GetMapping("/list")
    public Result list(){
        List<TProduct> list = productService.list();
        return Result.ok().data("productList", list);
    }

}

